libZPlay documentation (Win32)
IndexReferenceHome
PreviousUpNext
ZPlay.GetFFTData Method

Get FFT data for currently playing samples.

C#
public bool GetFFTData(int FFTPoints, TFFTWindow FFTWindow, ref int HarmonicNumber, ref int[] HarmonicFreq, ref int[] LeftAmplitude, ref int[] RightAmplitude, ref int[] LeftPhase, ref int[] RightPhase);
Parameters 
Description 
int FFTPoints 
Set this value to specify FFT size. This value must be power of 2. 
TFFTWindow FFTWindow 
Set this value to specify FFT window
ref int HarmonicNumber 
Reference to variable receiving number of harmonics returned from FFT analysis. NumberOfHarmonics = (nFFTPoints/2 + 1) 
ref int[] HarmonicFreq 
Reference to integer array receiving frequency of each harmonic. User must to allocate memory for this array. Use returned HarmonicNumber value to get number of harmonics.
 
ref int[] LeftAmplitude 
Reference to integer array receiving amplitude of each harmonic for left channel. Amplitude range is from 0 to about 120 dB. User needs to allocate memory for this array. User must to allocate memory for this array. Use returned HarmonicNumber value to get number of harmonics.
 
ref int[] RightAmplitude 
Reference to integer array receiving amplitude of each harmonic for right channel. Amplitude range is from 0 to about 120 dB. User must to allocate memory for this array. Use returned HarmonicNumber value to get number of harmonics.
 
ref int[] LeftPhase 
Reference to integer array receiving phase of each harmonic for left channel. Phase range is from -90 to 90 degrees. User must to allocate memory for this array. Use returned HarmonicNumber value to get number of harmonics.
 
ref int[] RightPhase 
Reference to integer array receiving phase of each harmonic for right channel. User must to allocate memory for this array. Use returned HarmonicNumber value to get number of harmonics.
 
Return Values 
Description 
True 
All OK. 
False 
Error. To get error message read here

FFTPoints parameter specifies number of samples for FFT algorithm. This parameter must be power of 2. Larger value produces more harmonics and better frequency resolution. But this needs more processor power to calculate FFT algorithm. 

Note: NumOfHarmnics = NumOfFFTPoints/2 + 1 

Note: FFT data are fully synchronized with audio data from wave buffer. 

Copyright (c) 2010. Zoran Cindori - All rights reserved.

Web: http://libzplay.sourceforge.net/

Email: zcindori@inet.hr